package org.example.blog.service.Impl;

import org.example.blog.mapper.ArticleMapper;
import org.example.blog.service.ArticleService;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class ArticleServiceImpl implements ArticleService {

    private final ArticleMapper articleMapper;

    public ArticleServiceImpl(ArticleMapper articleMapper) {
        this.articleMapper = articleMapper;
    }

    /**
     * 根据分类查找所有文章
     * @param category 分类
     */
    @Override
    public List<String> findAllArticleByCategory(String category) {
        return articleMapper.findAllArticleByCategory(category);

    }

    /**
     * 根据文章名称查找文章内容
     * @param articleName 文章名称
     */
    @Override
    public String findArticleContent(String articleName) {
        return articleMapper.findArticleContent(articleName);
    }

    /**
     * 根据文章名称查找文章标签
     * @param articleName 文章名称
     */
    @Override
    public List<String> findArticleTag(String articleName) {
        return articleMapper.findArticleTag(articleName);
    }

    /**
     * 根据文章名称查找文章分类
     * @param articleName 文章名称
     */
    @Override
    public String findArticleCategory(String articleName) {
        return articleMapper.findArticleCategory(articleName);
    }
}
